{
    let Pool = {};
    window.BulletPool = Pool;
    class Bullet extends Laya.Clip {
        constructor () {
            super();
            
            this.bulletId = null;
            this.speed = null;
            this.interval = 100;
            this.clipX = 1;
            this.autoPlay = true;
            this.anchorY = 0.5;

            // this.init();
        }

        // init () {
        //     this.skin = "res/game/bullet/normal.png";
        //     this.pivotX = 40;
        //     this.anchorY = 0.5;
        // }

        loop () {
            this.x += this.speed * Math.cos(this.rotation * Math.PI / 180);
            this.y += this.speed * Math.sin(this.rotation * Math.PI / 180);
        }

        reset (data) {
            this.bulletId = data.bid;
            this.rotation = data.a;
            this.isSkill = data.isSkill;
            this.x = data.x;
            this.y = data.y;

            this.zOrder = 2200;

            this.speed = data.s * 50 / 1000;

            Laya.timer.loop(50, this, this.loop);
            return this;
        }

        recover () {
            Laya.timer.clear(this, this.loop);
            this.bulletId = null;
            this.removeSelf();
            
            if(!Pool[this.constructor.name]){
                Pool[this.constructor.name] = [];
            }
            Pool[this.constructor.name].push(this);
        }

        static create (data) {
            if(Pool[this.name] && Pool[this.name].length){
                return Pool[this.name].pop().reset(data);
            }else{
                return (new this).reset(data);
            }
        }
    }

    Sail.class(Bullet, "Com.Room.Bullet.Base");
}